var zTree;
var level;

var setting = {

    view: {
        fontCss: setFontCss,
        dblClickExpand: false,
        showLine: false,
        expandSpeed: ($.browser.msie && parseInt($.browser.version) <= 6) ? "" : "fast"
    },
    data: {
        key: {
            name: "resourceName"
        },
        simpleData: {
            enable: true,
            idKey: "resourceID",
            pIdKey: "parentID",
            rootPId: ""
        }
    },
    callback: {
        // 				beforeExpand: beforeExpand,
        // 				onExpand: onExpand,
        onClick: zTreeOnClick
    }
};

//设置置灰
function setFontCss(treeId, treeNode) {
    if (treeNode.isParent) return;
    if (treeNode.accessPath == "" || treeNode.accessPath == "#") {
        return {color: "gainsboro"};
    }
}

var curExpandNode = null;

function beforeExpand(treeId, treeNode) {
    var pNode = curExpandNode ? curExpandNode.getParentNode() : null;
    var treeNodeP = treeNode.parentTId ? treeNode.getParentNode() : null;
    for (var i = 0, l = !treeNodeP ? 0 : treeNodeP.children.length; i < l; i++) {
        if (treeNode !== treeNodeP.children[i]) {
            zTree.expandNode(treeNodeP.children[i], false);
        }
    }
    while (pNode) {
        if (pNode === treeNode) {
            break;
        }
        pNode = pNode.getParentNode();
    }
    if (!pNode) {
        singlePath(treeNode);
    }

}

function singlePath(newNode) {
    if (newNode === curExpandNode) return;
    if (curExpandNode && curExpandNode.open == true) {
        if (newNode.parentTId === curExpandNode.parentTId) {
            zTree.expandNode(curExpandNode, false);
        } else {
            var newParents = [];
            while (newNode) {
                newNode = newNode.getParentNode();
                if (newNode === curExpandNode) {
                    newParents = null;
                    break;
                } else if (newNode) {
                    newParents.push(newNode);
                }
            }
            if (newParents != null) {
                var oldNode = curExpandNode;
                var oldParents = [];
                while (oldNode) {
                    oldNode = oldNode.getParentNode();
                    if (oldNode) {
                        oldParents.push(oldNode);
                    }
                }
                if (newParents.length > 0) {
                    for (var i = Math.min(newParents.length, oldParents.length) - 1; i >= 0; i--) {
                        if (newParents[i] !== oldParents[i]) {
                            zTree.expandNode(oldParents[i], false);
                            break;
                        }
                    }
                } else {
                    zTree.expandNode(oldParents[oldParents.length - 1], false);
                }
            }
        }
    }
    curExpandNode = newNode;
}

function onExpand(event, treeId, treeNode) {
    curExpandNode = treeNode;
}

/** 用于捕获节点被点击的事件回调函数  **/
function zTreeOnClick(event, treeId, treeNode) {
    var zTree = $.fn.zTree.getZTreeObj("dleft_tab1");
    zTree.expandNode(treeNode, null, null, null, true);
    // 		zTree.expandNode(treeNode);
    // 规定：如果是父类节点，不允许单击操作
    if (treeNode.isParent) {
        // 			alert("父类节点无法点击哦...");
        return false;
    }
    // 如果节点路径为空或者为"#"，不允许单击操作
    if (treeNode.accessPath == "" || treeNode.accessPath == "#") {
        alert("尚未开通");
        return false;
    }
    // 跳到该节点下对应的路径, 把当前资源ID(resourceID)传到后台，写进Session
    rightMain(treeNode.accessPath);

    if (treeNode.isParent) {
        $('#here_area').html('当前位置：' + treeNode.getParentNode().resourceName + '&nbsp;>&nbsp;<span style="color:#1A5CC6">' + treeNode.resourceName + '</span>');
    } else {
        $('#here_area').html('当前位置：&nbsp;' + treeNode.getParentNode().resourceName + ' &nbsp;>&nbsp;<span style="color:#1A5CC6">' + treeNode.resourceName + '</span>');
    }
};

/* 上方菜单 */
function switchTab(tabpage, tabid) {
    var oItem = document.getElementById(tabpage).getElementsByTagName("li");
    for (var i = 0; i < oItem.length; i++) {
        var x = oItem[i];
        x.className = "";
    }
    if ('left_tab2' == tabid) {
        $(document).ajaxStart(onStart).ajaxSuccess(onStop);
        // 异步加载"业务模块"下的菜单
        loadMenu('CESHIBAOGAO', 'dleft_tab1');
    } else if ('left_tab1' == tabid) {
        $(document).ajaxStart(onStart).ajaxSuccess(onStop);
        // 异步加载"第三方平台"下的菜单
        loadMenu('THIRDPLATFORM', 'dleft_tab1');
    } else if ('left_tab3' == tabid) {
        $(document).ajaxStart(onStart).ajaxSuccess(onStop);
        // 异步加载"系统管理"下的菜单
        loadMenu('XITONGSHEZHI', 'dleft_tab1');
    } else if ('left_tab4' == tabid) {
        $(document).ajaxStart(onStart).ajaxSuccess(onStop);
        // 异步加载"问题反馈"下的菜单
        loadMenu('WENTIFANKUI', 'dleft_tab1');
    } else if ('left_tab5' == tabid) {
        $(document).ajaxStart(onStart).ajaxSuccess(onStop);
        // 异步加载"job"下的菜单
        loadMenu('JOBLIST', 'dleft_tab1');
    }
}

$(document).ready(function () {
    $(document).ajaxStart(onStart).ajaxSuccess(onStop);
    /** 默认异步加载"业务模块"目录  **/
    loadMenu('THIRDPLATFORM', 'dleft_tab1');
    document.getElementById("nav_module").style.display = "none";

    //checkUserLevel();
    // 默认展开所有节点
    if (zTree) {
        // 默认展开所有节点
        zTree.expandAll(true);
    }
});


function loadTypeMenu(resourceType) {

    var treeObj = "dleft_tab1";
    //online
    var temp1 = [
        // 服务端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 8,
            "resourceName": "服务端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        // 全接口测试
        {
            "accessPath": "/html/report_list/Report_list_api_test.html?tablename=online_service_api_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 8,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 81,
            "resourceName": "全接口测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // Web端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 2,
            "resourceName": "Web端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        // 冒烟测试
        {
            "accessPath": "/html/report_list/Report_list_online.html?tablename=online_web_smoke_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 21,
            "resourceName": "冒烟测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        // 核心功能测试
        {
            "accessPath": "/html/report_list/Report_list_online.html?tablename=online_web_core_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 22,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        // 兼容性测试
        {
            "accessPath": "/html/report_list/Report_list_qa.html?tablename=online_web_compatibility_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 23,
            "resourceName": "兼容性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 23,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // Android端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 3,
            "resourceName": "Android端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 3,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 31,
            "resourceName": "冒烟测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 3,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 32,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // iphone端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 4,
            "resourceName": "iPhone端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 4,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 41,
            "resourceName": "冒烟测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 4,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 42,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // pc端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 5,
            "resourceName": "Pc端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 5,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 51,
            "resourceName": "冒烟测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 5,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 52,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // imac端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 6,
            "resourceName": "iMac端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 6,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 61,
            "resourceName": "冒烟测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 6,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 62,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // ipad端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 7,
            "resourceName": "iPad端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 7,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 71,
            "resourceName": "冒烟测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 7,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 72,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

    ];
    //TEST
    var temp2 = [
        // 服务端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 8,
            "resourceName": "服务端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        // 全接口测试
        {
            "accessPath": "/html/report_list/Report_list_api_test.html?tablename=test_service_api_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 8,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 81,
            "resourceName": "全接口测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // Web端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 2,
            "resourceName": "Web端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        // 核心功能测试
        {
            "accessPath": "/html/report_list/Report_list_online.html?tablename=test_web_core_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 21,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // Android端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 3,
            "resourceName": "Android端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 3,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 31,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // iphone端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 4,
            "resourceName": "iPhone端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 4,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 41,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // pc端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 5,
            "resourceName": "Pc端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 5,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 51,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // imac端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 6,
            "resourceName": "iMac端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 6,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 61,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // ipad端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 7,
            "resourceName": "iPad端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 7,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 71,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

    ];
    //QA
    var temp3 = [
        // 服务端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 8,
            "resourceName": "服务端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 8,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 81,
            "resourceName": "核心接口测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        // 全接口测试
        {
            "accessPath": "/html/report_list/Report_list_api_test.html?tablename=qa_service_api_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 8,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 82,
            "resourceName": "全接口测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 8,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 83,
            "resourceName": "安全性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // Web端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 2,
            "resourceName": "Web端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        // 核心功能测试
        {
            "accessPath": "/html/report_list/Report_list_online.html?tablename=qa_web_core_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 21,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 22,
            "resourceName": "全功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 23,
            "resourceName": "稳定性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        // 语言环境测试
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 26,
            "resourceName": "语言环境测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "/html/report_list/Report_list_gray_web_language.html?tablename=qa_web_language_english_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 26,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 4,
            "resourceID": 263,
            "resourceName": "English(Page)",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "/html/report_list/Report_list_gray_web_language.html?tablename=qa_web_language_chinese_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 26,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 4,
            "resourceID": 264,
            "resourceName": "简体中文(Page)",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "/html/report_list/Report_list_gray_web_language.html?tablename=qa_web_language_traditional_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 26,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 4,
            "resourceID": 265,
            "resourceName": "繁体中文(Page)",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // Android端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 3,
            "resourceName": "Android端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 3,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 31,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 3,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 32,
            "resourceName": "全功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 3,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 33,
            "resourceName": "稳定性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 3,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 34,
            "resourceName": "兼容性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // iphone端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 4,
            "resourceName": "iPhone端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 4,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 41,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 4,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 42,
            "resourceName": "全功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 4,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 43,
            "resourceName": "稳定性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 4,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 44,
            "resourceName": "兼容性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // PC端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 5,
            "resourceName": "Pc端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 5,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 51,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 5,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 52,
            "resourceName": "全功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 5,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 53,
            "resourceName": "稳定性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 5,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 54,
            "resourceName": "兼容性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // imac端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 6,
            "resourceName": "iMac端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 6,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 61,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 6,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 62,
            "resourceName": "全功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 6,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 63,
            "resourceName": "稳定性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 6,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 64,
            "resourceName": "兼容性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // ipad端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 7,
            "resourceName": "iPad端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 7,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 71,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 7,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 72,
            "resourceName": "全功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 7,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 73,
            "resourceName": "稳定性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 7,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 74,
            "resourceName": "兼容性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

    ];

    //HUIDU
    var temp4 = [
        // 服务端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 8,
            "resourceName": "服务端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 8,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 81,
            "resourceName": "核心接口测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 8,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 82,
            "resourceName": "全接口测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 8,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 83,
            "resourceName": "安全性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // Web端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 2,
            "resourceName": "Web端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        // 核心功能测试
        {
            "accessPath": "/html/report_list/Report_list_online.html?tablename=gray_web_core_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 21,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 22,
            "resourceName": "全功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 23,
            "resourceName": "稳定性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        // 兼容性测试
        {
            "accessPath": "/html/report_list/Report_list_qa.html?tablename=gray_web_compatibility_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 24,
            "resourceName": "兼容性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 25,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        // 语言环境测试
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 26,
            "resourceName": "语言环境测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "/html/report_list/Report_list_gray_web_language.html?tablename=gray_web_language_english_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 26,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 4,
            "resourceID": 263,
            "resourceName": "English(Page)",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "/html/report_list/Report_list_gray_web_language.html?tablename=gray_web_language_chinese_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 26,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 4,
            "resourceID": 264,
            "resourceName": "简体中文(Page)",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "/html/report_list/Report_list_gray_web_language.html?tablename=gray_web_language_traditional_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 26,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 4,
            "resourceID": 265,
            "resourceName": "繁体中文(Page)",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "/html/report_list/Report_list_gray_web_language_en.html?tablename=gray_web_language_english_properties_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 26,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 4,
            "resourceID": 261,
            "resourceName": "English(Properties)",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "/html/report_list/Report_list_gray_web_language_tw.html?tablename=gray_web_language_traditional_properties_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 26,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 4,
            "resourceID": 262,
            "resourceName": "中文繁体(Properties)",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // Android端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 3,
            "resourceName": "Android端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        // 核心功能测试
        {
            "accessPath": "/html/report_list/Report_list_online.html?tablename=gray_android_core_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 3,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 31,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 3,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 32,
            "resourceName": "全功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 3,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 33,
            "resourceName": "稳定性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 3,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 34,
            "resourceName": "兼容性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 3,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 35,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // iphone端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 4,
            "resourceName": "iPhone端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        // 冒烟测试
        {
            "accessPath": "/html/report_list/Report_list_online.html?tablename=gray_iphone_smoke_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 4,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 45,
            "resourceName": "冒烟测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 4,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 41,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 4,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 42,
            "resourceName": "全功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 4,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 43,
            "resourceName": "稳定性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 4,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 44,
            "resourceName": "兼容性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 4,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 45,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // pc端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 5,
            "resourceName": "Pc端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 5,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 51,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 5,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 52,
            "resourceName": "全功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 5,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 53,
            "resourceName": "稳定性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 5,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 54,
            "resourceName": "兼容性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 5,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 55,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // imac端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 6,
            "resourceName": "iMac端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 6,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 61,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 6,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 62,
            "resourceName": "全功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 6,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 63,
            "resourceName": "稳定性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 6,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 64,
            "resourceName": "兼容性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 6,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 65,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        // ipad端
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 7,
            "resourceName": "iPad端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 7,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 71,
            "resourceName": "核心功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 7,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 72,
            "resourceName": "全功能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 7,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 73,
            "resourceName": "稳定性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 7,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 74,
            "resourceName": "兼容性测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 7,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 75,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

    ];
    switch (resourceType) {
        case 'Online':
            data = temp1;
            break;
        case 'QA':
            data = temp3;
            break;
        case 'TEST':
            data = temp2;
            break;
        case  'HUIDU':
            data = temp4;
            break;
    }
    // 如果返回数据不为空，加载"业务模块"目录
    if (data != null) {
        // 将返回的数据赋给zTree
        $.fn.zTree.init($("#" + treeObj), setting, data);
//              alert(treeObj);
        zTree = $.fn.zTree.getZTreeObj(treeObj);
        if (zTree) {
            // 默认展开所有节点
            zTree.expandAll(true);
        }
    }
}

function loadMenu(resourceType, treeObj) {

    var name = document.getElementById("userstatus").value;
    // 测试报告tab的json数据
    var temp = [
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 2,
            "resourceName": "Web端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "/html/report_list/Report_list_online.html?tablename=online_web_smoke_report",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 21,
            "resourceName": "冒烟测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 2,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 22,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 3,
            "resourceName": "Android端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 3,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 31,
            "resourceName": "冒烟测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 3,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 32,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 4,
            "resourceName": "iPhone端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 4,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 41,
            "resourceName": "冒烟测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 4,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 42,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 5,
            "resourceName": "Pc端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 5,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 51,
            "resourceName": "冒烟测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 5,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 52,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },

        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 6,
            "resourceName": "iMac端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 6,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 61,
            "resourceName": "冒烟测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 6,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 62,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 1,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 2,
            "resourceID": 7,
            "resourceName": "iPad端",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 7,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 71,
            "resourceName": "冒烟测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
        {
            "accessPath": "",
            "checked": false,
            "delFlag": 0,
            "parentID": 7,
            "resourceCode": "",
            "resourceDesc": "",
            "resourceGrade": 3,
            "resourceID": 71,
            "resourceName": "性能测试",
            "resourceOrder": 0,
            "resourceType": ""
        },
    ];
    data = temp;
    switch (resourceType) {
        case 'CESHIBAOGAO':
            document.getElementById("default_button").click();
            //data =temp;
            break;
        case 'THIRDPLATFORM':
            data = [
                {
                    "accessPath": "",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 1,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 2,
                    "resourceID": 2,
                    "resourceName": "Git代码统计",
                    "resourceOrder": 0,
                    "resourceType": ""
                },
                {
                    "accessPath": "/html/third_platform/gitcode_only_master.html",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 2,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 2,
                    "resourceID": 21,
                    "resourceName": "仅Master分支",
                    "resourceOrder": 0,
                    "resourceType": ""
                },
                {
                    "accessPath": "",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 1,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 2,
                    "resourceID": 3,
                    "resourceName": "JiraBug统计",
                    "resourceOrder": 0,
                    "resourceType": ""
                },
                {
                    "accessPath": "",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 3,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 31,
                    "resourceName": "指标1",
                    "resourceOrder": 0,
                    "resourceType": ""
                },
                {
                    "accessPath": "",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 3,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 32,
                    "resourceName": "指标2",
                    "resourceOrder": 0,
                    "resourceType": ""
                }
            ];
            break;
        case 'XITONGSHEZHI':
            if (level == 10) {
                data = [
                    {
                        "accessPath": "",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 1,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 2,
                        "resourceID": 2,
                        "resourceName": "个人信息",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                    {
                        "accessPath": "/html/settings/Information_list.html?" + "name=" + name + "",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 2,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 3,
                        "resourceID": 21,
                        "resourceName": "查询个人信息",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },

                    {
                        "accessPath": "/html/settings/allInformation_list.html?",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 2,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 3,
                        "resourceID": 22,
                        "resourceName": "查询全部信息",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                    {
                        "accessPath": "",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 1,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 2,
                        "resourceID": 3,
                        "resourceName": "修改信息",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                    {
                        "accessPath": "/html/settings/Information_update.html?" + "name=" + name + "",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 3,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 3,
                        "resourceID": 31,
                        "resourceName": "修改密码",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                    {
                        "accessPath": "",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 1,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 2,
                        "resourceID": 4,
                        "resourceName": "消息中心",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                    {
                        "accessPath": "/html/settings/Message_record.html?type=user",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 4,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 3,
                        "resourceID": 41,
                        "resourceName": "用户相关",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                    {
                        "accessPath": "/html/settings/Message_record.html?type=question",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 4,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 3,
                        "resourceID": 42,
                        "resourceName": "反馈相关",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                    {
                        "accessPath": "/html/settings/Message_record.html?type=email",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 4,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 3,
                        "resourceID": 43,
                        "resourceName": "邮件相关",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                    {
                        "accessPath": "/html/settings/Message_record.html?type=jenkins",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 4,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 3,
                        "resourceID": 43,
                        "resourceName": "Jenkins相关",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                ];
                break;
            } else {
                data = [{
                    "accessPath": "",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 1,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 2,
                    "resourceID": 2,
                    "resourceName": "个人信息",
                    "resourceOrder": 0,
                    "resourceType": ""
                },
                    {
                        "accessPath": "/html/settings/Information_list.html?" + "name=" + name + "",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 2,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 3,
                        "resourceID": 21,
                        "resourceName": "查询个人信息",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                    {
                        "accessPath": "",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 1,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 2,
                        "resourceID": 3,
                        "resourceName": "修改信息",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                    {
                        "accessPath": "/html/settings/Information_update.html?" + "name=" + name + "",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 3,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 3,
                        "resourceID": 31,
                        "resourceName": "修改密码",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                    {
                        "accessPath": "",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 1,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 2,
                        "resourceID": 4,
                        "resourceName": "消息中心",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                    {
                        "accessPath": "/html/settings/Message_record.html?type=user",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 4,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 3,
                        "resourceID": 41,
                        "resourceName": "用户相关",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                    {
                        "accessPath": "/html/settings/Message_record.html?type=question",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 4,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 3,
                        "resourceID": 42,
                        "resourceName": "反馈相关",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                    {
                        "accessPath": "/html/settings/Message_record.html?type=email",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 4,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 3,
                        "resourceID": 43,
                        "resourceName": "邮件相关",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                    {
                        "accessPath": "/html/settings/Message_record.html?type=jenkins",
                        "checked": false,
                        "delFlag": 0,
                        "parentID": 4,
                        "resourceCode": "",
                        "resourceDesc": "",
                        "resourceGrade": 3,
                        "resourceID": 43,
                        "resourceName": "Jenkins相关",
                        "resourceOrder": 0,
                        "resourceType": ""
                    },
                ];
                break;
            }

        case 'WENTIFANKUI':
            data = [{
                "accessPath": "",
                "checked": false,
                "delFlag": 0,
                "parentID": 1,
                "resourceCode": "",
                "resourceDesc": "",
                "resourceGrade": 2,
                "resourceID": 2,
                "resourceName": "问题反馈",
                "resourceOrder": 0,
                "resourceType": ""
            },
                {
                    "accessPath": "/html/questions/question_response.html?" + "name=" + name + "",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 2,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 21,
                    "resourceName": "问题反馈",
                    "resourceOrder": 0,
                    "resourceType": ""
                },
                {
                    "accessPath": "/html/questions/Question_list.html",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 2,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 22,
                    "resourceName": "查看反馈",
                    "resourceOrder": 0,
                    "resourceType": ""
                },
                {
                    "accessPath": "/html/questions/My_Question_list.html?" + "name=" + name + "",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 2,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 22,
                    "resourceName": "我的反馈进度",
                    "resourceOrder": 0,
                    "resourceType": ""
                },
            ];
            break;
        case 'JOBLIST':
            data = [{
                "accessPath": "",
                "checked": false,
                "delFlag": 0,
                "parentID": 1,
                "resourceCode": "",
                "resourceDesc": "",
                "resourceGrade": 2,
                "resourceID": 2,
                "resourceName": "Jenkins",
                "resourceOrder": 0,
                "resourceType": ""
            },
                {
                    "accessPath": "/html/jenkins/Job_List.html?Type=TEST",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 2,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 21,
                    "resourceName": "TEST",
                    "resourceOrder": 0,
                    "resourceType": ""
                },

                {
                    "accessPath": "/html/jenkins/Job_List.html?Type=TEST%PublicCloud",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 21,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 211,
                    "resourceName": "Web端",
                    "resourceOrder": 0,
                    "resourceType": ""
                },
                {
                    "accessPath": "/html/jenkins/Job_List.html?Type=TEST%Interface",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 21,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 212,
                    "resourceName": "服务端",
                    "resourceOrder": 0,
                    "resourceType": ""
                },

                {
                    "accessPath": "/html/jenkins/Job_List.html?Type=QA",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 2,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 22,
                    "resourceName": "QA",
                    "resourceOrder": 0,
                    "resourceType": ""
                },

                {
                    "accessPath": "/html/jenkins/Job_List.html?Type=QA%PublicCloud",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 22,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 221,
                    "resourceName": "Web端",
                    "resourceOrder": 0,
                    "resourceType": ""
                },
                {
                    "accessPath": "/html/jenkins/Job_List.html?Type=QA%Interface",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 22,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 222,
                    "resourceName": "服务端",
                    "resourceOrder": 0,
                    "resourceType": ""
                },
                {
                    "accessPath": "/html/jenkins/Job_List.html?Type=GRAY",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 2,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 23,
                    "resourceName": "Gray",
                    "resourceOrder": 0,
                    "resourceType": ""
                },

                {
                    "accessPath": "/html/jenkins/Job_List.html?Type=GRAY%PublicCloud",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 23,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 231,
                    "resourceName": "Web端",
                    "resourceOrder": 0,
                    "resourceType": ""
                },
                {
                    "accessPath": "/html/jenkins/Job_List.html?Type=GRAY%Interface",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 23,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 232,
                    "resourceName": "服务端",
                    "resourceOrder": 0,
                    "resourceType": ""
                },
                {
                    "accessPath": "/html/jenkins/Job_List.html?Type=GRAY%Android",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 23,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 233,
                    "resourceName": "Android端",
                    "resourceOrder": 0,
                    "resourceType": ""
                },

                {
                    "accessPath": "/html/jenkins/Job_List.html?Type=ONLINE",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 2,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 24,
                    "resourceName": "Online",
                    "resourceOrder": 0,
                    "resourceType": ""
                },

                {
                    "accessPath": "/html/jenkins/Job_List.html?Type=ONLINE%PublicCloud",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 24,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 241,
                    "resourceName": "Web端",
                    "resourceOrder": 0,
                    "resourceType": ""
                },
                {
                    "accessPath": "/html/jenkins/Job_List.html?Type=ONLINE%Interface",
                    "checked": false,
                    "delFlag": 0,
                    "parentID": 24,
                    "resourceCode": "",
                    "resourceDesc": "",
                    "resourceGrade": 3,
                    "resourceID": 242,
                    "resourceName": "服务端",
                    "resourceOrder": 0,
                    "resourceType": ""
                },

            ];
            break;
    }

    // 如果返回数据不为空，加载"业务模块"目录
    if (data != null) {
        // 将返回的数据赋给zTree
        $.fn.zTree.init($("#" + treeObj), setting, data);
//              alert(treeObj);
        zTree = $.fn.zTree.getZTreeObj(treeObj);
        if (zTree) {
            // 默认展开所有节点
            zTree.expandAll(true);
        }
    }
}

//ajax start function
function onStart() {
    $("#ajaxDialog").show();
}

//ajax stop function
function onStop() {
    // 		$("#ajaxDialog").dialog("close");
    $("#ajaxDialog").hide();
}

function checkUserLevel() {
    if (level < 3) {
        document.getElementById("left_tab1").style.display = "none";
        document.getElementById("left_tab4").style.display = "none";
    }
}